<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="#0A5AF9">
    <title>设置</title>
    <link rel="stylesheet" type="text/css" href="../css/public-head.css" />
    <link rel="stylesheet" type="text/css" href="../css/set-up.css" />
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
    <style>
        html,
        body {
            background-color: #eeeeee;
        }
    </style>
</head>

<body>

    <div class="main">
        <div class="list_gren" tapmode onclick="Personal()">
            <div>个人信息</div>
            <span><img src="../image/icon/ARROWRIGHT@2x.png" alt="" /></span>
        </div>


        <div class="list_gren" tapmode onclick="modifypassword()">
            <div>修改支付密码</div>
            <span><img src="../image/icon/ARROWRIGHT@2x.png" alt="" /></span>
        </div>
        <div class="list_gren">
            <div>服务协议</div>
            <span><img src="../image/icon/ARROWRIGHT@2x.png" alt="" /></span>
        </div>
        <div class="list_gren list-border" tapmode onclick="aboutUs()">
            <div>关于我们</div>
            <span><img src="../image/icon/ARROWRIGHT@2x.png" alt="" /></span>
        </div>
        <div class="list_gren list-bind" tapmode onclick="bindbefore()">
            <div>账号绑定</div>
            <div><span>绑定/解绑</span><span><img src="../image/icon/ARROWRIGHT@2x.png" alt="" /></span></div>
        </div>
        <div class="list-border list_out" tapmode onclick="logout()">
            <div>退出登录</div>
        </div>
    </div>



</body>
<script type="text/javascript" src="../script/public-head.js"></script>
<script type="text/javascript" src="../script/rem.js"></script>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/mui.js"></script>

<script type="text/javascript">
    headInner({
        title: "",
        //headleft
        headl: '<a  style="color:white" class="mui-icon mui-icon-left-nav" tapmode onclick="api.closeWin()" ></a>',
        //headright
        headr: '<a style="color:white"></a>',
        color: "", //默认是蓝色
        padding: "0px 0px 0px",
    })

    function logout() {
        api.confirm({
            title: '车车侠',
            msg: '是否退出登录？',
            buttons: ['确定', '取消']
        }, function(ret, err) {
            var index = ret.buttonIndex;
            // alert(JSON.stringify(ret));
            if (index == 1) {
                // $api.rmStorage('masterInfo');
                Signout();
            } else {
                return false;
                // alert(JSON.stringify(err));
            }
        });
    }
    // 退出登陆
    function Signout() {
        BASE.MYajax({
            'pathName': 'auth/logout', //请求路径
            'methods': 'post',
            'ajaxData': {},
            'method': backData //调用函数
        });
    }

    function backData(ret, err) {
        if (ret.code == 200) {
            $api.rmStorage('token');
            $api.rmStorage('UserBase');
            Refresh()
            // 提示
            api.toast({
                msg: ret.message,
                duration: 2000,
                location: 'bottom',
                global: true
            });
            api.closeToWin({
                name: 'Login'
            });
            api.openWin({
                name: 'Login',
                url: 'Login.html',
                animation: {
                    type: "ripple", //动画类型（详见动画类型常量）
                    duration: 1000 //动画过渡时间，默认300毫秒
                }
            });
        } else {
            reToast(ret, err)
        }
    }
    // api.ajax({
    //     url: URL + 'auth/logout',
    //     method: 'POST',
    //     headers: Headers
    // }, function(ret, err) {
    //   // console.log(JSON.stringify(ret));
    //     // console.log(JSON.stringify(err));
    //     if (ret.code == 200) {
    //
    //         // 退出清除token
    //         api.removePrefs({ //删除偏好设置值
    //             key: 'token'
    //         });
    //         $api.rmStorage('token');
    //         // 提示
    //         api.toast({
    //             msg: '注销成功',
    //             duration: 2000,
    //             location: 'bottom',
    //             global: true
    //         });
    //         //alert( ret.message );
    //         return as();
    //     } else {
    //         alert(JSON.stringify(err))
    //     }
    // });

    function Refresh() {
        api.execScript({
            // window名字
            name: 'Main_Frame',
            // frame名字
            frameName: 'homepage_2',
            // 执行win下的frame中的方法
            script: 'fnGetInfo();',
        });

        api.execScript({
            // window名字
            name: 'Main_Frame_two',
            // frame名字
            frameName: 'RechargePayment',
            // 执行win下的frame中的方法
            script: 'fnGetLoginData1();',
        });
        api.execScript({
            // window名字
            name: 'Main_Frame',
            // frame名字
            frameName: 'RechargePayment',
            // 执行win下的frame中的方法
            script: 'fnGetLoginData1();',
        });

        api.execScript({
            // window名字
            name: 'Main_Frame_two',
            frameName: 'mine_2',
            // 执行win下的frame中的方法
            script: 'fnGetLoginDatamine();',
        });
    }

    function as() {
        api.openWin({
            name: 'homepage_2',
            url: '../html/homepage_2.html',
            bounces: false,
            opaque: false,
            showProgress: true,
            vScrollBarEnabled: false,
            hScrollBarEnabled: false,
            slidBackEnabled: false,
            delay: 300,
            animation: {
                duration: 400
            }
        });
    }

    function Personal() {
        api.openWin({
            name: 'Personal',
            url: 'Personal.html'
        });
    }

    function modifypassword() {
        api.openWin({
            name: 'setting-payment-password',
            url: '../html/setting-payment-password.html'
        });
    }

    function aboutUs() {
        api.openWin({
            name: 'aboutUs',
            url: '../html/aboutUs.html'
        });
    }

    function bindbefore() {
        api.openWin({
            name: 'bind-on-account-before',
            url: '../html/bind-on-account-before.html'
        });
    }

    function mine_2() {
        api.openWin({
            name: 'mine_2',
            url: '../html/mine_2.html'
        });
    }
</script>

</html>
